package flow

import (
	//"time"
	"gitee.com/antflow/api/v1/flow/template:template"
)

#FlowOpResponse: {
	code:    int
	message: string
}

#FlowListResponse: {
	flows: [...#FlowSpec]
}

#FlowOpRequest: {
	name:      string
	namespace: string
	group:     string
	version:   string
}

#FlowSpec: {
	@po()
	name:      string @pk()
	namespace: string @pk()
	version:   string @pk()
	desc:      string
	template:  string
	trigger:   string | *"http"
	enable:    bool | *true
}

#FlowService: {
	@srv()
	apply:  template.#Template @return(#FlowSpec)
	patch:  template.#Template @return(#FlowSpec)
	delete: template.#Template @return(#FlowOpResponse)
	rm:     #FlowOpRequest     @return(#FlowOpResponse)
	get:    #FlowOpRequest     @return(#FlowListResponse)
}
